/*
 * @Author: 郑刘利
 * @Date: 2020-03-18 15:13:22
 * @LastEditors: 郑刘利
 * @LastEditTime: 2020-03-18 15:56:22
 * @Description: file content
 */

import { Limiter } from './Limiter';
import { Message } from '../domain/chat/Message';

export class ChatService {
    public async getMessage(id: string, limiter: Limiter) {
        return new Array(10).fill(0).map((_, i) => {
            const to = { id: String(i + 1), nickname: 'name' + i, avatarUrl: '' };
            const from = { id: String(i + 2), nickname: 'name' + i + 2, avatarUrl: '' };
            const payload = i % 2 === 0 ? { url: '111' } : { text: '111' };
            return new Message({ id: String(i), to, from, type: 0 }, payload);
        });
    }
}
